package com.swt.gap.service;

import com.swt.gap.common.PageResult;
import com.swt.gap.model.entity.File;
import com.swt.gap.model.params.ElementSameForm;
import com.swt.gap.model.params.UpdateFileParam;
import com.swt.gap.model.vo.*;
import com.swt.gap.model.vo.file.FileInfoVO;
import com.swt.gap.model.vo.file.FileSameElementVO;
import org.springframework.web.bind.annotation.RequestParam;

import javax.servlet.http.HttpServletRequest;
import java.net.UnknownHostException;
import java.util.List;

/**
 * @Author tyh
 * @Date 2020/4/22 15:34
 */
public interface FileService {

    /**
     * 添加数据信息
     */
//    Integer addNewFile(UploadFileVO.FileInfo fileInfo, int fileClassId, Boolean repeat);

    Integer addFile(File file);

    PageResult<TaskFileVO> getTaskFileByKey(Integer taskId, String keyword, Integer pageNum, Integer pageSize);

    Integer updateSameFile(UploadFileVO.FileInfo fileInfo, Integer fileId);

    /**
     * 删除上传成功的数据
     */
    Integer deleteSuccessFile(Integer fileId);

    /**
     * 根据id获取数据
     * @param fileId
     * @return
     */
    File getFileByid(Integer fileId);

    /**
     * 旧的重名数据做覆盖处理
     */
    UploadFileVO coverFile(String savedFileName, Double fileSize, Integer oldFileId);

    UploadFileVO uploadRepeatFile(String fileName, Integer fileId);

    /**
     * 根据数据id获取预览地址
     * @param fileId
     * @return
     */
    UrlVO getUrlByFileId(Integer fileId) throws UnknownHostException;



    Integer deleteBatchFile(List<Integer> fileIds);

    FileInfoVO getFileInfo(Integer fileId, Integer viewType);

    PageResult<FileSameElementVO> getFileSameElements(Integer fileId,  Integer page,  Integer size, List<ElementSameForm>elementIds);

    Boolean saveFileInfo(List<FileMetaInfo> fileInfo);

    Boolean saveFileInfo(SaveFileInfoVO record);

    EventExtractVO parseElement(String originalFileName, String text);
    EventExtractVO parseElementNew(String originalFileName, String text);

    Boolean isExistsFileName(String fileName, Integer fileClassId, Integer fileType);

    Integer updateFileTextElement(UpdateFileParam record);
}
